package com.huawei.appmarket.service.videostream.view;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.VideoStreamListCardBean;
import com.huawei.appmarket.support.video.VideoPlayer;
import o.cgz;
import o.cii;
import o.cjk;
import o.cjm;
import o.cjo;
import o.ckt;
import o.emt;
import o.emu;
import o.eqx;
import o.evp;
import o.evp.b;
import o.evt;
import o.ewm.j;

public class VideoStreamItemCard extends BaseDistCard {
    private VideoPlayer ʼ;
    private emu ˋ;
    private VideoStreamListCardBean ॱॱ;

    public VideoStreamItemCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        return this;
    }

    public void ˋ(View view) {
        this.ˋ = new emu(view.getContext());
        this.ʼ = (VideoPlayer) view.findViewById(j.ˊʳ);
        this.ʼ.setController(this.ˋ);
        ˋ(this.ˋ.ॱ);
        ˏ(this.ˋ.ˋ);
        this.ˋ.ˊ.setOnClickListener(new ckt(new OnClickListener(this) {
            final /* synthetic */ VideoStreamItemCard ॱ;

            {
                this.ॱ = r1;
            }

            public void onClick(View view) {
                if (view.getContext() != null) {
                    Context context = view.getContext();
                    if (!cii.ˊ().ˊ(context, this.ॱ.ॱॱ)) {
                        cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
                        appDetailActivityProtocol.ˏ(new Request(this.ॱ.ˊᐝ.ॱॱ(), this.ॱ.ॱॱ.u_()));
                        cjk.ˎ().ˋ(context, new cjm("appdetail.activity", appDetailActivityProtocol));
                    }
                }
            }
        }));
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof VideoStreamListCardBean) {
            this.ॱॱ = (VideoStreamListCardBean) cardBean;
            this.ˋ.setVideoRatio(emt.ˊ(this.ॱॱ.ʼˋ()));
            evp ॱ = new b().ˊ(this.ॱॱ.ᐝʽ()).ˋ(this.ॱॱ.ʻˋ()).ˎ(this.ॱॱ.ʽᐝ()).ˏ(this.ॱॱ.ͺˏ()).ॱ(this.ॱॱ.u_()).ʼ(this.ॱॱ.ᐝʻ()).ᐝ(this.ॱॱ.ॱﾟ()).ʻ(evt.ˏ(this.ॱॱ.sp_)).ॱॱ(this.ॱॱ.ॱـ()).ॱ();
            if (this.ʼ.ॱᐝ()) {
                this.ʼ.setVideoBaseInfo(ॱ);
            }
            if (!TextUtils.isEmpty(this.ॱॱ.ʾ())) {
                this.ˋ.setControllerLayoutParams();
            }
            int i = j.ʿˈ;
            int i2 = j.ʿʿ;
            String str = (String) this.ˋ.ˎ.getTag(i);
            String str2 = (String) this.ˋ.ˎ.getTag(i2);
            if (TextUtils.isEmpty(str2) || !str2.equals(this.ॱॱ.ʻᐝ())) {
                this.ˋ.ˎ.setTag(i2, this.ॱॱ.ʻᐝ());
                eqx.ˏ(this.ʼ.ॱॱ(), this.ॱॱ.ᐝʽ(), "app_default_icon");
                if (TextUtils.isEmpty(str) || !str.equals(this.ॱॱ.ʻˋ())) {
                    this.ˋ.ˎ.setTag(i, this.ॱॱ.ʻˋ());
                    this.ʼ.setVideoBaseInfo(ॱ);
                    this.ʼ.setCurrentMode(11);
                    this.ˋ.ˎ.setText(this.ॱॱ.v_());
                    if (this.ॱॱ.ٴ() != 0) {
                        this.ˋ.ˏ.setText(this.ॱॱ.ߴ());
                    } else {
                        this.ˋ.ˏ.setText(this.ॱॱ.ˎͺ());
                    }
                    ˋ(this.ˋ.ʼ, this.ॱॱ.ˋʻ());
                }
            }
        }
    }
}
